﻿@{
    ViewBag.Title = "软件_用户注册";
    Layout = null;
}
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title></title>
    <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
    <link rel="stylesheet" type="text/css" href="~/themes/kingcens/css/reset.css">
    <link rel="stylesheet" type="text/css" href="~/themes/kingcens/css/style1.css?v=191923001">
    <link rel="stylesheet" type="text/css" href="~/themes/kingcens/css/tip-darkgray.css">
    <link rel="stylesheet" type="text/css" href="~/themes/kingcens/css/tip-green.css">
    <link rel="stylesheet" type="text/css" href="~/themes/kingcens/css/tip-skyblue.css">
    <link rel="stylesheet" type="text/css" href="~/themes/kingcens/css/tip-twitter.css">
    <link rel="stylesheet" type="text/css" href="~/themes/kingcens/css/tip-violet.css">
    <link rel="stylesheet" type="text/css" href="~/themes/kingcens/css/tip-yellow.css">
    <link rel="stylesheet" type="text/css" href="~/themes/kingcens/css/tip-yellowsimple.css">
    <link href="@Url.Content("~/Scripts/miniui/themes/default/miniui.css")" rel="stylesheet" type="text/css"/>
    <link href="@Url.Content("~/Scripts/miniui/themes/icons.css")" rel="stylesheet" type="text/css"/>
    <link href="@Url.Content("~/Scripts/miniui/themes/jqueryui-cupertino/skin.css")" rel="stylesheet" type="text/css"/>
    <link href="@Url.Content("~/Scripts/miniui/themes/default/large-mode.css")" rel="stylesheet" type="text/css"/>
    <script src="@Url.Content("~/Scripts/jquery-1.7.1.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/miniui/miniui.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/themes/kingcens/js/jquery.tooltip.js")" type="text/javascript"></script>
    

    <!--[if IE 8]>
		<link href="../themes/kingmenu/css/index1440.css" media="screen and (min-width: 1440px) and (max-width: 1900px)" rel="stylesheet"/>
		<link href="../themes/kingmenu/css/index1300.css" media="screen and (min-width: 1300px) and (max-width: 1440px)" rel="stylesheet"/>
		<link href="../themes/kingmenu/css/index1000.css" media="screen and (min-width: 1000px) and (max-width: 1300px)" rel="stylesheet"/>
		<link href="../themes/kingmenu/css/index780.css" media="screen and (min-width: 750px) and (max-width: 1000px)" rel="stylesheet"/>
		<script src="../themes/kingmenu/js/respond.min.js"></script>
	<![endif]-->

    <style>
        html {
           background: #fff; 
        }
        .mini-buttonedit-border {
            height: 40px;
            padding-left: 20px;
        }
    .mini-buttonedit-button {
        height: 40px;
        margin-top: -1px;
        margin-right: -1px;
    }
    .mini-buttonedit .mini-buttonedit-input {
        height: 40px;
    }
        .main {
            height: 500px;
        }
        .login-box-warp1 {
            height: 470px;
        }
    </style>
</head>
<body>
<div class="hander">
	<div class="hander-center">
		<a href="#" class="logo" title="logo"><img src="@ViewBag.logo"></a>
	</div>
</div>
<div class="min main">
    @*<img src="~/themes/kingcens/images/min_bj.png">*@
    <div class="mainConten">
        <div class="mainLeft">
		    <img id="textImg" src="@ViewBag.solution" />
		    <div class="leftText">
                <button style="">详情了解</button>
			    <img id="mainIcon" src="../themes/kingmenu/img/pic.png" />
		    </div>
		    <img id="max" src="../themes/kingmenu/img/people.png" />
	    </div>
        <div class="content-layout">
            <div class="login-box-warp1">
                <div class="login-title" style="float:left;margin-right:20px;"><span>用户注册</span></div>
                @*<div class="login-title_1" onclick="gologin()"><span>用户登录</span></div>*@
                <div class="login-title_1" onclick="gologin()"><span>登录 ></span></div>
                <div class="static-form">
                    <form role="form" id="form1" action="@Url.Action("Registe")" method="post"  onClick="return submitForm()">
                        <div class="username-field">
						    <span><input id="product" name="product" class="mini-combobox" style="width:300px; height: 42px;" textField="text" valueField="id" 
                                url="/Home/GetSoftwareVersions" value="@ViewBag.product" allowInput="false" showNullItem="false" /></span>
                            <label class="username">版本:</label>
					    </div>
					    <div class="username-field">
						    <label class="username">手机:</label>
						    <span><input class="login-name" type="text" name="username" id="username" value="@ViewBag.username" onclick="clearError" placeholder="请输入手机号码" msg="手机号码不正确!"></span>
					    </div>
					    <div class="field pwd-field">
						    <label class="userpwd">密码:</label>
						    <span><input class="logo-pwd" type="password" name="password" id="password" onclick="clearError" value="@ViewBag.password" placeholder="请输入密码(6至16个字符)" msg="密码由大小写字母及数字组成，且6至16个字符。请重新输入。"></span>
					    </div>
					    <div class="field pwd-field">
						    <label class="userpwd">确认密码:</label>
						    <span><input class="logo-pwd" type="password" name="password2" id="password2" onclick="clearError" value="@ViewBag.password2" placeholder="再次输入密码(6至16个字符)" msg="密码由大小写字母及数字组成，且6至16个字符。请重新输入。"></span>
					    </div>
					    <div class="username-field">
						    <label class="ICode">邀请码:</label>
						    <span><input class="login-name" type="text" name="ICode" id="ICode" value="@ViewBag.ICode" onclick="clearError" placeholder="请输入邀请码(没有码可不填)" msg="邀请码不正确！请重新输入。"></span>
					    </div>
					    <div class="field code-field">
						    <label class="userpwd"></label>
						    <span><input class="logo-pwd code-wid" type="text" name="identify" id="identify" onclick="clearError" value="@ViewBag.vcode" placeholder="验证码" autoComplete="off" msg="请输入验证码！"></span>
						    <button class="code_time">获取验证码</button>
					    </div>
                        <div class="field identify">

                        </div>
                        <div class="submit-bnt" style="margin-top:15px;">
						    <button class="btn">快速注册</button>
					    </div>
					    <div class="user-register">点击注册表示您已同意《服务条款》</div>
                        <input type="hidden" name="error" id="error" value="@ViewBag.error" />
                        <input type="hidden" name="errorCode" id="errorCode" value="@ViewBag.errorCode" />
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
<div class="footer">
	<div class="foot-center clearfix">
		<div class="foot-info">
@*            <p class="name">广州博亚诚电子科技有限公司</p>
			<p class="link">官方网址: <a href="http://www.bycpos.com" target="_blank">http://www.bycpos.com</a></p>*@
			<p class="name">@ViewBag.present</p>
			<p class="link">官方网址: <a href="@ViewBag.url" target="_blank">@ViewBag.url</a></p>
		</div>
	</div>
</div>
    <script>
        function initalusername(msg) {
            if (msg != "")
                $("#username").attr("msg", msg);
            $('#username').poshytip({
                className: 'tip-twitter',
                showOn: 'focus',
                alignTo: 'target',
                alignX: 'center',
                alignY: 'bottom',
                offsetX: 0,
                offsetY: 5
            });
        }
        function initalICode(msg) {
            if (msg != "")
                $("#ICode").attr("msg", msg);
            $('#ICode').poshytip({
                className: 'tip-twitter',
                showOn: 'focus',
                alignTo: 'target',
                alignX: 'inner-left',
                offsetX: 0,
                offsetY: 5
            });
        }
        function initalpassword(msg) {
            if (msg != "")
                $("#password").attr("msg", msg);
            $('#password').poshytip({
                className: 'tip-twitter',
                showOn: 'focus',
                alignTo: 'target',
                alignX: 'center',
                alignY: 'bottom',
                offsetX: 0,
                offsetY: 5
            });
        }
        function initalpassword2(msg) {
            if (msg != "")
                $("#password2").attr("msg", msg);
            $('#password2').poshytip({
                className: 'tip-twitter',
                showOn: 'focus',
                alignTo: 'target',
                alignX: 'center',
                alignY: 'bottom',
                offsetX: 0,
                offsetY: 5
            });
        }
        function initalidentify(msg) {
            if (msg != "")
                $("#identify").attr("msg", msg);
            $('#identify').poshytip({
                className: 'tip-twitter',
                showOn: 'focus',
                alignTo: 'target',
                alignX: 'inner-left',
                offsetX: 0,
                offsetY: 5
            });
        }

        var ck = "";
        $(function () {
            mini.parse();
            initalusername('');
            //initalICode('');
            initalpassword();
            initalpassword2();
            initalidentify();
            $("#username").click(function () {
                $("#username").poshytip("disable");
            });
            $("#ICode").click(function () {
                $("#ICode").poshytip("disable");
            });
            $("#password").click(function () {
                $("#password").poshytip("disable");
            });
            $("#password2").click(function () {
                $("#password2").poshytip("disable");
            });
            $("#identify").click(function () {
                $("#identify").poshytip("disable");
            });
            if ($("#identify").val() != "") {
                $(".code_time").attr({ "disabled": "disabled" });
                $(".code_time").click(function () {
                    mini.showTips({ content: "验证码已已存在。", state: "danger", x: "center", y: "top", timeout: 5000 });
                });
            }
            else {
                $(".code_time").click(function () {
                    ck = "";
                    var reg = /^1[0-9]{10}$/;
                    var phoneNum = $("#username").val();
                    var flag = reg.test(phoneNum);
                    if (!flag) {
                        mini.showTips({ content: "请输入正确的手机号码！", state: "danger", x: "center", y: "top", timeout: 5000 });
                        return;
                    }
                    $.post("GetVerifyCode", { phone: phoneNum }, function (data) {
                        var mdata = mini.decode(data);
                        if (mdata.code == 1) {
                            mini.showTips({ content: "验证码已发送到你的手机，请注意查看。" + mdata.icode, state: "success", x: "center", y: "top", timeout: 5000 });
                            timer();
                            $(".code_time").attr({ "disabled": "disabled" });
                        }
                        else {
                            mini.showTips({ content: mdata.msg, state: "danger", x: "center", y: "top", timeout: 10000 });
                        }
                    });
                });
            }
            $(".btn").click(function () { ck = "submit"; });
            if ($("#error").val() != "") {
                debugger;
                var data = JSON.parse($("#error").val());
                if (data.success == 1) {
                    mini.alert(data.msg, '', function () {
                        window.location.href = "../Home/Login";
                    });
                }
                else {
                    mini.showTips({ content: "注册失败！ " + data.msg, state: "danger", x: "center", y: "top", timeout: 5000 });
                }
            }
        });
        function clearError() {
            $(".identify").html("");

        }
        var time = 60;
        function timer() {
            $(".code_time").html("还剩" + time + "秒");
            time--;
            if (time > 0)
                setTimeout(timer, 1000);
            else {
                time = 60;
                $(".code_time").html("获取验证码");
                $(".code_time").removeAttr("disabled");
            }
        }
        function gologin() {
            window.location.href = "login";
        }
        function submitForm() {
            if (ck == "submit") {
                $(".identify").html("");
                var reg = /^1[0-9]{10}$/;
                var phoneNum = $("#username").val();
                var retvalue = true;
                var flag = reg.test(phoneNum);
                if (!flag && retvalue) {
                    $("#username").poshytip("enable");
                    $('#username').poshytip('show');
                    retvalue = false;
                }
                //reg = /^[\d]{4}||[\d]{11}$/;
                //var ICode = $("#ICode").val();
                //flag = reg.test(ICode);
                //if (!flag && retvalue) {
                //    $("#ICode").poshytip("enable");
                //    $('#ICode').poshytip('show');
                //    retvalue = false;
                //}
                var password = $("#password").val();
                var password2 = $("#password2").val();
                if (password != password2 && retvalue) {
                    initalpassword2("两次输入密码不相同！请重新输入。");
                    $("#password2").poshytip("enable");
                    $('#password2').poshytip('show');
                    retvalue = false;
                }
                var pwdreg = /[a-zA-Z0-9]{6,16}/;
                if (!pwdreg.test(password) && retvalue) {
                    $("#password").poshytip("enable");
                    $('#password').poshytip('show');
                    retvalue = false;
                }
                //if ($("#identify").val() == "" && retvalue) {
                //    $("#password").poshytip("enable");
                //    $('#password').poshytip('show');retvalue = false;
                //}
                ck = "";
                if (retvalue)
                    return true;
                else {
                    $(".identify").css("display", "block");
                    return false;
                }
            }
            else
                return false;
        }
    </script>
</body>
</html>
